package com.bite.mybatisdemo.mapper;

import com.bite.mybatisdemo.model.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UserInfoMapper {

    //查询所有用户
    @Select("select * from userinfo")
    List<UserInfo> queryAllUser();

    @Select("select * from userinfo where id = #{id}")
    UserInfo queryUserById(Integer id);



    @Insert("insert into userinfo(username,`password`,age,gender,phone) values (#{username},#{password},#{age},#{gender},#{phone})")
    Integer insertUser(UserInfo userInfo);


    @Delete("delete from userinfo where id = #{id}")
    Integer deleteUserById(Integer id);

    @Update("update userinfo set `password` = #{password} where id = #{id}")
    Integer updateUser(UserInfo userInfo);


}
